home *** CD-ROM | disk | FTP | other *** search
Wrap
property spriteNum, row, motion, location, fp global tableau, stock, equal, getlist, godlist, reserve, currentsel, dimpos, extras on beginSprite me row = determinerow() location = sprite(spriteNum).loc if not objectp(tableau[row]) then tableau.addProp(row, new(script("card pile"))) sprite(spriteNum).member = member(stock.cards[1].rank & "_" & stock.cards[1].suit, "playing cards") stock.cards.deleteAt(1) tableau[row].addCard(spriteNum) if voidp(reserve[row]) then reserve.addProp(row, []) end if repeat with i = 1 to 2 reserve[row].add(stock.cards[1].rank & "_" & stock.cards[1].suit) stock.cards.deleteAt(1) end repeat end if candd = [#one: 12, #two: 28, #thr: 44, #fou: 60, #fiv: 76, #six: 92, #sev: 108] fp = candd[row] end on determinerow me if (spriteNum >= 12) and (spriteNum <= 25) then return #one else if (spriteNum >= 28) and (spriteNum <= 41) then return #two else if (spriteNum >= 44) and (spriteNum <= 57) then return #thr else if (spriteNum >= 60) and (spriteNum <= 73) then return #fou else if (spriteNum >= 76) and (spriteNum <= 89) then return #fiv else if (spriteNum >= 92) and (spriteNum <= 105) then return #six else if (spriteNum >= 108) and (spriteNum <= 121) then return #sev end if end if end if end if end if end if end if end on mouseDown me if sprite(spriteNum).member <> member("empty", "playing cards") then puppetSound(3, member("pick card", "100GPak Generic SFX")) if reserve[row].count > 0 then sprite(tableau[row].cards[1].spnum - 1).member = member("backofcard", "playing cards") else sprite(tableau[row].cards[1].spnum - 1).member = member("empty", "playing cards") end if if spriteNum = tableau[row].getlastcard().spnum then sprite(spriteNum).locZ = spriteNum + 1000 getlist = tableau[row] motion = timeout(string(spriteNum)).new(5, #moving, me) else runcheck() end if else sendSprite(spriteNum - 1, #mouseDown) end if end on moving me if the mouseDown then sprite(spriteNum).loc = the mouseLoc else if the mouseUp then motion.forget() sprite(spriteNum).locZ = spriteNum abort() end if end if end on mouseUp me if equal then puppetSound(3, member("pick card", "100GPak Generic SFX")) if extras.count = 0 then sprite(currentsel).member = member(sprite(spriteNum).member.name, "playing cards") godlist.addCard(currentsel) tableau[row].cards.deleteOne(tableau[row].getlastcard()) sprite(spriteNum).member = member("empty", "playing cards") sprite(spriteNum).loc = location else if extras.count > 0 then extras.sort() repeat with i = 0 to extras.count - 1 sprite(currentsel + i).member = member(sprite(the clickOn + i).member.name, "playing cards") sprite(the clickOn + i).member = member("empty", "playing cards") godlist.addCard(currentsel + i) tableau[row].cards.deleteAt(tableau[row].getcardcount()) sprite(the clickOn + i).loc = sprite(the clickOn + i).location end repeat extras.deleteAll() end if end if getlist = VOID godlist = VOID equal = 0 if tableau[row].getcardcount() = 0 then if reserve[row].count() > 0 then sprite(fp).member = member(reserve[row][1], "playing cards") reserve[row].deleteAt(1) tableau[row].addCard(fp) else sprite(fp).member = member("empty", "playing cards") end if end if repeat with u in [26, 42, 58, 74, 90, 106, 122] if tableau[sprite(u).row].getcardcount() = 0 then temp = [12, 28, 44, 60, 76, 92, 108] temp2 = [26, 42, 58, 74, 90, 106, 122] ass = temp[temp2.findPos(u)] sprite(u).loc = sprite(ass).location next repeat end if sprite(u).loc = tableau[sprite(u).row].getlastcard().location end repeat checkwin(currentsel) currentsel = 0 else if not equal then puppetSound(3, member("drop card", "100GPak Generic SFX")) sprite(spriteNum).loc = location getlist = VOID if extras > 0 then repeat with i = 1 to extras.count sprite(extras[i]).loc = sprite(extras[i]).location end repeat extras.deleteAll() end if end if end if if tableau[row].getcardcount() = 0 then sprite(fp - 1).member = member("empty", "playing cards") end if end on runcheck me ass = 0 repeat with i = 1 to tableau[row].getcardcount() if tableau[row].cards[i].spnum = spriteNum then ss = i dimpos = i exit repeat end if end repeat tt = ss + 1 repeat with ret = tt to tableau[row].getcardcount() if tableau[row].cards[ret].suit <> tableau[row].cards[ret - 1].suit then exit repeat end if if (tableau[row].cards[ret].rankvalue <> (tableau[row].cards[ret - 1].rankvalue - 1)) and ((tableau[row].cards[ret].rankvalue <> 1) and (tableau[row].cards[ret - 1].rankvalue <> 13)) then exit repeat end if if ret <> tableau[row].getcardcount() then next repeat end if ass = 1 end repeat if ass then getlist = tableau[sprite(tableau[row].cards[i].spnum).row] sprite(tableau[row].cards[ss].spnum).locZ = tableau[row].cards[ss].spnum + 1000 sprite(tableau[row].cards[ss].spnum).motion = timeout(string(row) && string(spriteNum)).new(5, #moving, sprite(tableau[row].cards[ss].spnum)) extras.add(spriteNum) repeat with ret = tt to tableau[row].getcardcount() sprite(tableau[row].cards[ret].spnum).locZ = tableau[row].cards[ret].spnum + 1000 sprite(tableau[row].cards[ret].spnum).motion = timeout(string(row) && string(tableau[row].cards[ret].spnum)).new(1, #keepintouch, sprite(tableau[row].cards[ret].spnum)) extras.add(tableau[row].cards[ret].spnum) end repeat end if end on keepintouch me if the mouseDown then sprite(spriteNum).loc = point(the mouseH, sprite(spriteNum - 1).locV + 25) else if the mouseUp then sprite(spriteNum).locZ = spriteNum motion.forget() abort() end if end if end on backCardEQ me if spriteNum <> fp then if (sprite(spriteNum - 1).member.name <> "backofcard") and (sprite(spriteNum - 1).member.name <> "empty") then if (getValue(sprite(spriteNum).member.name) = (getValue(sprite(spriteNum - 1).member.name) - 1)) and (getSuit(sprite(spriteNum).member.name) = getSuit(sprite(spriteNum - 1).member.name)) then repeat with shit = spriteNum - 1 to spriteNum - 1 repeat with cakes = 1 to tableau.count if tableau[cakes].getcardcount() = 0 then next repeat end if if (getValue(sprite(shit).member.name) = (getValue(sprite(tableau[cakes].getlastcard().spnum).member.name) - 1)) and not getduplicate(tableau[cakes].getlastcard().spnum) then return 1 exit end if end repeat end repeat else sendSprite(spriteNum - 1, #backCardEQ) end if end if end if return 0 end on getduplicateme me, argu if (sprite(spriteNum - 1).member.name <> "empty") and (sprite(spriteNum - 1).member.name <> "backofcard") then if getValue(sprite(spriteNum - 1).member.name) = getValue(sprite(argu).member.name) then return 1 end if end if return 0 end